package com.chuan.state;

//上帝守护你
public class TestDaemon {
    public static void main(String[] args) {
        God god = new God();
        You you = new You();

        Thread thread = new Thread(god);
        thread.setDaemon(true);
        thread.start();//上帝守护线程启动

        new Thread(you).start();//你用户线程启动
    }
}

//God
class God implements Runnable{
    @Override
    public void run() {
        while(true){
            System.out.println("God bless u");
        }
    }
}


//You
class You implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 36500; i++) {
            System.out.println("live happily");
        }
        System.out.println("=====bye~bye=====");
    }
}